package san.java.day13;

import java.io.*;

/**
 * 标准输入输出流
 */

public class SystemInOut_04 {

    public static void main(String[] args) {
//        try {
//            testSystemIn();
//        } catch (IOException e) {
//            e.printStackTrace();
//        }

        try {
            testSystemOut();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void testSystemIn() throws IOException {
        InputStreamReader is = new InputStreamReader(System.in);

        BufferedReader br = new BufferedReader(is);

        String str = "";

        while ((str = br.readLine()) != null) {
            System.out.println(str);
        }

        br.close();
        is.close();
    }

    /**
     * 将字符串内容写入System.out
     */
    public static void testSystemOut() throws IOException {
        OutputStreamWriter os = new OutputStreamWriter(System.out);
        BufferedWriter bw = new BufferedWriter(os);

        String s = "hello hello hello hello hello hello hello";
//        System.out.println(s);
        bw.write(s);
        bw.close();
        os.close();
    }
}
